// routes/subscription.routes.js
const express = require('express');
const router = express.Router();

// 导入控制器
const {
  getSubscriptionPlans,
  createSubscription,
  getCurrentSubscription,
  cancelSubscription
} = require('../controllers/subscription.controller');

// 导入中间件
const {
  authenticateToken
} = require('../middleware/auth.middleware');

// 获取所有订阅计划端点
router.get('/plans', getSubscriptionPlans);

// 为用户创建订阅端点
router.post('/', authenticateToken, createSubscription);

// 获取用户当前订阅端点
router.get('/current', authenticateToken, getCurrentSubscription);

// 取消订阅端点
router.delete('/:subscriptionId', authenticateToken, cancelSubscription);

module.exports = router;